package cn.gok.homework;

import java.util.Comparator;

public class MyComparator implements Comparator {
    @Override
    public int compare(Object o1, Object o2) {
        Student student1 = (Student) o1;
        Student student2 = (Student) o2;
        if (student1.getSid() > student2.getSid()){
            return 1;
        }else if (student1.getSid() < student2.getSid()){
            return -1;
        }else {
            if (student1.getAge() > student2.getAge()){
                return 1;
            }else {
                return -1;
            }
        }
    }
}
